// 添加请求拦截器
import axios from 'axios'
import router from '../router'
axios.interceptors.request.use(
  config => {
    const token = localStorage.getItem('accessToken')
    if (token) {
      config.headers.Authorization = `bearer ${token}`
    } else {
      //   跳转到登录页
      router.push('/login')
    }
    return config
  },
  error => {
    return Promise.reject(error)
  }
)
